Skip to content

feat(provider): native Ollama provider for local models - #119

Merged
prashar32 merged 2 commits into
mainfrom
feat/ollama-provider
Jun 13, 2026
Merged

feat(provider): native Ollama provider for local models#119
prashar32 merged 2 commits into
mainfrom
feat/ollama-provider

Conversation

@prashar32

Copy link
Copy Markdown
Owner

Replaces the Ollama stub with a real provider — run local models through RiskKernel with the same budgets, proxy, audit trail, and crash-resume as a hosted provider. Closes #23.

RISKKERNEL_DEFAULT_PROVIDER=ollama riskkernel serve   # key-free, local
  • Talks to Ollama's /api/chat (non-streaming). System prompt leads as a system message; MaxTokensnum_predict; Temperature passed through.
  • Token usage comes from Ollama's prompt_eval_count / eval_count, so the governor meters and the cost ledger prices local runs exactly like hosted ones (a local model is typically $0, which the pricing table already handles).
  • Key-free and ctx-aware — the kill switch and time budget interrupt an in-flight generation.
  • RISKKERNEL_OLLAMA_BASE_URL points it at a remote Ollama (default http://localhost:11434).

Bedrock remains the one stub. Tests cover the happy path (request shape + usage mapping against a mock server), a surfaced API error, and the base-URL default/trim. go vet clean; full suite green.


Based on the v0.6.0 release branch (#118) so its CHANGELOG sits in the post-release [Unreleased]. Once #118 merges I'll rebase this onto main (drops the release commit, no CHANGELOG conflict). It targets the next release.

Roll the changelog into the 0.6.0 section and bump the version markers across the
runtime and both SDKs.

- CHANGELOG.md: [Unreleased] → [0.6.0] (2026-06-13) + fresh [Unreleased]; links.
- internal/version: 0.5.1-dev → 0.6.1-dev (un-stamped local builds).
- sdks/python: 0.5.0 → 0.6.0 (pyproject + __init__).
- sdks/typescript: 0.5.0 → 0.6.0 (package.json + lockfile, version-only).
- docs/VISION: status line → v0.6.0.

The 0.6.0 line: Slack approvals, policy-as-code (POST /v1/policies + riskkernel.yaml
+ dry-run), the compliance evidence export, and the published enforcement-overhead
number + public roadmap.
Replace the Ollama stub with a real provider against Ollama's /api/chat
(non-streaming). System prompt leads as a system message, MaxTokens maps to
num_predict, and token usage comes from prompt_eval_count / eval_count so the
governor and cost ledger meter local runs exactly like hosted ones. It's key-free
(local) and honors ctx, so the kill switch and time budget interrupt an in-flight
generation. RISKKERNEL_OLLAMA_BASE_URL points it at a remote server (default
http://localhost:11434); empty uses the local default.

Budgets, the proxy, audit, and crash-resume all work unchanged for ollama runs —
set RISKKERNEL_DEFAULT_PROVIDER=ollama. Tests cover the happy path (request shape +
usage mapping against a mock server), a surfaced API error, and the base-URL
default/trim. Bedrock remains the one stub.
@prashar32
prashar32 merged commit 8b63179 into main Jun 13, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Native Ollama provider (local models)

1 participant